package com.ycz;

import com.ycz.config.AppConfig;
import com.ycz.service.OrderService;
import com.ycz.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * @Author:ycz
 * @date:2021/6/8
 */
public class AopAppcalition {

    public static void main(String[] args) {

        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(AppConfig.class);
        applicationContext.register(UserService.class);
        applicationContext.register(OrderService.class);
        applicationContext.refresh();
        UserService userService = applicationContext.getBean("userService", UserService.class);
        // 测试事务 AppConfig使用@Config事务生效 使用@Component事务失效
        userService.testTransaction();

    }


}
